package com.jn.exam.paperConsumer.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jn.exam.R;
import com.jn.exam.paperConsumer.entity.PaperQuestionAnswer;
import com.jn.exam.paperConsumer.service.PaperQuestionAnswerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.catalina.LifecycleState;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author 江南大学1033190417
 * @date 2022/3/25 15:09
 */
@Api(description = "考试统计")
@RestController
@RequestMapping("/paperConsumer/statistical")
public class ScoreStatisticalController {

    @Autowired
    private PaperQuestionAnswerService paperQuestionAnswerService;

    @ApiOperation(value = "查询一道题目的得分情况")
    @GetMapping("getStatisticalOfOnePaperQuestion/{paperQuestionId}")
    public R getStatisticalOfOnePaperQuestion(@PathVariable("paperQuestionId") String paperQuestionId){
        List<Map<String,Object>> result=paperQuestionAnswerService.getStatisticalOfOnePaperQuestion(paperQuestionId);
        List<Map<String,Object>> result2=paperQuestionAnswerService.getMaxMinAvgOfOnePaperQuestion(paperQuestionId);
        return R.ok().data("result",result).data("mma",result2);
    }

}
